<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
		<title>淘转课堂</title>
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<link rel="stylesheet" type="text/css" href="css/login.css" />
		<script src="js/rem.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div class="main">
			<img src="img/28@2x.png" class="background" width="100%" />
			<div class="login">
				<div>
					<img src="img/31@3x.png" />
					<input type="text" placeholder="请输入用户名" id="user" name="username" />
				</div>
				<div>
					<img src="img/30@2x.png" />
					<input type="password" placeholder="请输入密码" id="psw" name="possword" />
				</div>
			</div>
			<div class="but">
				登&nbsp;录
			</div>
			<div class="fail">
				用户或密码不能为空
			</div>
			<div class="fail2">
				用户或密码不正确
			</div>
		</div>
		<script src="js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			getOpenId();
			$(".but").click(function() {
				var username = $("#user").val(),
					password = $("#psw").val();
				$.ajax({
					url: apiPath + 'user/login',
					type: 'post',
					dataType: 'json',
					data: {
						open_id: open_id,
						username: username,
						password: password,
						flagsign: 1
					},
					success: function(data) {
						if(data.status == 1) {
							saveData('token', data.returnData.token);
							window.location.href = path + "classroom.html"
						} else {
							$(".fail2").show();
							setTimeout(function() {
								$(".fail2").hide();
							}, 1000);
						}
					}
				});
			});
			// 兼容Android 键盘弹起时,影响布局
			var h = document.body.scrollHeight // 用onresize事件监控窗口或框架被调整大小，先把一开始的高度记录下来
			window.onresize = function() { // 如果当前窗口小于一开始记录的窗口高度，那就让当前窗口等于一开始窗口的高度
				if(document.body.scrollHeight < h) {
					document.body.style.height = h + "px"
				}
			}
		</script>
	</body>

</html>